FROM ubuntu:20.04

COPY sources.list /etc/apt/sources.list

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt install -y \
	make cmake build-essential software-properties-common libclang-dev ninja-build gcc git bison \
	python3 gperf pkg-config libfontconfig1-dev libfreetype6-dev libx11-dev \
	libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev \
	libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev \
	libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev \
	libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev libatspi2.0-dev \
	libgl1-mesa-dev libglu1-mesa-dev libncurses-dev openssl freeglut3-dev tar figlet wget

# 将文件添加到相应目录下
COPY build_qt6.sh /usr/local/bin

COPY lubancat_qt6.cmake /opt

RUN mkdir -p /build && \
  chmod +x /usr/local/bin/build_qt6.sh

# 添加Qt6 host
#

# 添加交叉编译器，如果注释，后面编译脚本会从网络拉取
ADD gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz /opt

# 添加Qt5.15.8源码，如果注释，后面编译脚本会从网络拉取
ADD qt-everywhere-src-6.2.4.tar.xz /opt

# 添加sysroot文件
ADD sysroot_debian10.tar.gz /opt

# 切换当前工作目录
WORKDIR /build

# 指定默认命令,交叉编译Qt6中基础模块（支持eglfs，xcb，wayland等），不包括qtwebengine等
CMD ["/usr/local/bin/build_qt6.sh"]
